<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QDesignerWidgetBoxInterface Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QDesignerWidgetBoxInterface Class Reference<br /><sup><sup>[<a href="qtdesigner.html">QtDesigner</a> module]</sup></sup></h1><p>The QDesignerWidgetBoxInterface class allows you to control the contents of Qt Designer's widget box. <a href="#details">More...</a></p>
<p>Inherits <a href="qwidget.html">QWidget</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdesignerwidgetboxinterface.html#QDesignerWidgetBoxInterface">__init__</a></b> (<i>self</i>, QWidget&#160;<i>parent</i>&#160;=&#160;None, Qt.WindowFlags&#160;<i>flags</i>&#160;=&#160;0)</li><li><div class="fn" />QString <b><a href="qdesignerwidgetboxinterface.html#fileName">fileName</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdesignerwidgetboxinterface.html#load">load</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qdesignerwidgetboxinterface.html#save">save</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdesignerwidgetboxinterface.html#setFileName">setFileName</a></b> (<i>self</i>, QString)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDesignerWidgetBoxInterface class allows you to control the contents of Qt Designer's widget box.</p>
<p>QDesignerWidgetBoxInterface contains a collection of functions that is typically used to manipulate the contents of <i>Qt Designer</i>'s widget box.</p>
<p><i>Qt Designer</i> uses an XML file to populate its widget box. The name of that file is one of the widget box's properties, and you can retrieve it using the <a href="qdesignerwidgetboxinterface.html#fileName">fileName</a>() function.</p>
<p>QDesignerWidgetBoxInterface also provides the <a href="qdesignerwidgetboxinterface.html#save">save</a>() function that saves the contents of the widget box in the file specified by the widget box's file name property. If you have made changes to the widget box, for example by dropping a widget into the widget box, without calling the <a href="qdesignerwidgetboxinterface.html#save">save</a>() function, the original content can be restored by a simple invocation of the <a href="qdesignerwidgetboxinterface.html#load">load</a>() function:</p>
<pre>         QDesignerWidgetBoxInterface *widgetBox = 0:
         widgetBox = formEditor-&gt;widgetBox();

         widgetBox-&gt;load();</pre>
<p>The QDesignerWidgetBoxInterface class is not intended to be instantiated directly. You can retrieve an interface to Qt Designer's widget box using the <a href="qdesignerformeditorinterface.html#widgetBox">QDesignerFormEditorInterface.widgetBox</a>() function. A pointer to <i>Qt Designer</i>'s current <a href="qdesignerformeditorinterface.html">QDesignerFormEditorInterface</a> object (<tt>formEditor</tt> in the example above) is provided by the <a href="qdesignercustomwidgetinterface.html#initialize">QDesignerCustomWidgetInterface.initialize</a>() function's parameter. When implementing a custom widget plugin, you must subclass the <a href="qdesignercustomwidgetinterface.html">QDesignerCustomWidgetInterface</a> to expose your plugin to <i>Qt Designer</i>.</p>
<p>If you want to save your changes, and at the same time preserve the original contents, you can use the <a href="qdesignerwidgetboxinterface.html#save">save</a>() function combined with the <a href="qdesignerwidgetboxinterface.html#setFileName">setFileName</a>() function to save your changes into another file. Remember to store the name of the original file first:</p>
<pre>         QString originalFile = widgetBox-&gt;fileName();

         widgetBox-&gt;setFileName("myWidgetBox.xml");
         widgetBox-&gt;save();</pre>
<p>Then you can restore the original contents of the widget box by resetting the file name to the original file and calling <a href="qdesignerwidgetboxinterface.html#load">load</a>():</p>
<pre>         widgetBox-&gt;setFileName(originalFile);
         widgetBox-&gt;load();</pre>
<p>In a similar way, you can later use your customized XML file:</p>
<pre>         if (widgetBox-&gt;filename() != "myWidgetBox.xml") {
             widgetBox-&gt;setFileName("myWidgetBox.xml");
             widgetBox-&gt;load();
         }</pre>
<p>See also <a href="qdesignerformeditorinterface.html">QDesignerFormEditorInterface</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDesignerWidgetBoxInterface" />QDesignerWidgetBoxInterface.__init__ (<i>self</i>, <a href="qwidget.html">QWidget</a>&#160;<i>parent</i>&#160;=&#160;None, <a href="qt-windowflags.html">Qt.WindowFlags</a>&#160;<i>flags</i>&#160;=&#160;0)</h3><p>The <i>parent</i> argument, if not None, causes <i>self</i> to be owned by Qt instead of PyQt.</p><p>Constructs a widget box interface with the given <i>parent</i> and the specified window <i>flags</i>.</p>
<a name="//apple_ref/cpp/instm/QDesignerWidgetBoxInterface/~QDesignerWidgetBoxInterface" />
<h3 class="fn"><a name="fileName" />QString QDesignerWidgetBoxInterface.fileName (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Returns the name of the XML file <i>Qt Designer</i> is currently using to populate its widget box.</p>
<p>See also <a href="qdesignerwidgetboxinterface.html#setFileName">setFileName</a>().</p>
<a name="//apple_ref/cpp/instm/QDesignerWidgetBoxInterface/load" />
<h3 class="fn"><a name="load" />bool QDesignerWidgetBoxInterface.load (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Populates <i>Qt Designer</i>'s widget box by loading (or reloading) the currently specified XML file. Returns true if the file is successfully loaded; otherwise false.</p>
<p>See also <a href="qdesignerwidgetboxinterface.html#setFileName">setFileName</a>().</p>
<a name="//apple_ref/cpp/instm/QDesignerWidgetBoxInterface/save" />
<h3 class="fn"><a name="save" />bool QDesignerWidgetBoxInterface.save (<i>self</i>)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Saves the contents of <i>Qt Designer</i>'s widget box in the file specified by the <a href="qdesignerwidgetboxinterface.html#fileName">fileName</a>() function. Returns true if the content is successfully saved; otherwise false.</p>
<p>See also <a href="qdesignerwidgetboxinterface.html#fileName">fileName</a>() and <a href="qdesignerwidgetboxinterface.html#setFileName">setFileName</a>().</p>
<a name="//apple_ref/cpp/instm/QDesignerWidgetBoxInterface/setFileName" />
<h3 class="fn"><a name="setFileName" />QDesignerWidgetBoxInterface.setFileName (<i>self</i>, QString)</h3><p>This method is abstract and should be reimplemented in any sub-class.</p><p>Sets the XML file that <i>Qt Designer</i> will use to populate its widget box, to <i>fileName</i>. You must call <a href="qdesignerwidgetboxinterface.html#load">load</a>() to update the widget box with the new XML file.</p>
<p>See also <a href="qdesignerwidgetboxinterface.html#fileName">fileName</a>() and <a href="qdesignerwidgetboxinterface.html#load">load</a>().</p>
<p /><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;snapshot-4.7.1-5014f7c72a58 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.1</td></tr></table></div></address></body></html>